<ul class="thumbnails koudoku-pricing-table">
  <% @plans.each do |plan| %>
    <li class="span3 plan <%= 'plan-primary' if plan.highlight? %>">
      <div class="thumbnail">
        <div class="caption">
          <h3><%= plan.name %></h3>
          <h4><%= plan_price(plan) %></h4>
          <div class="call-to-action">
            <% if @subscription.nil? %>
              <%= link_to Koudoku.free_trial? ? t('koudoku.plan_difference.start_trial') : t('koudoku.subscriptions.sign_up'), koudoku.new_subscription_path(plan: plan.id), class: "btn btn-success btn-large" %>
            <% elsif @subscription.persisted? %>
              <% if @subscription.plan == plan %>
                <%= form_for @subscription, url: owner_subscription_path(@owner, @subscription) do |f| %>
                  <%= f.submit t('koudoku.plan_difference.selected'), class: "btn btn-large", disabled: 'disabled' %>
                <% end %>
              <% else %>
                <%= form_for @subscription, url: owner_subscription_path(@owner, @subscription) do |f| %>
                  <%= f.hidden_field :plan_id, value: plan.id %>
                  <%= f.submit @subscription.describe_difference(plan), class: "btn btn-success btn-large" %>
                <% end %>
              <% end %>
            <% else %>
              <%= link_to Koudoku.free_trial? ? t('koudoku.plan_difference.start_trial') : t('koudoku.plan_difference.upgrade'), new_owner_subscription_path(@owner, plan: plan.id), class: "btn btn-success btn-large" %>
            <% end %>
          </div>
          <ul class="features">
            <% if Koudoku.free_trial? %>
            <li class='muted'><%= t('koudoku.subscriptions.free_trial_for_days', :days => Koudoku.free_trial_length) %></li>
            <% end %>
            <%= BlueCloth.new(plan.features.gsub(/\n/, "\n\n")).to_html.gsub(/<(\/?)p>/, '<\1li>').html_safe %>
          </ul>
        </div>
      </div>
    </li>
  <% end %>

  <li class="span3 social-proof">
    <%= render 'koudoku/subscriptions/social_proof' %>
  </li>
</ul>
